﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="OrderList.aspx.cs" Inherits="Golf.WebUI.AdminShow.OrderManagement.OrderList" %>

<%@ Register Assembly="FlexiGrid" Namespace="FlexiGrid" TagPrefix="cc1" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
    <title>订单表</title>
    <link href="../../Script/FlexiGrid/css/contextmenu.css" rel="stylesheet" type="text/css" />
    <link href="../../Script/FlexiGrid/css/main.css" rel="stylesheet" type="text/css" />
    <link href="../../Script/FlexiGrid/css/flexigrid.css" rel="stylesheet" type="text/css" />

    <script type="text/javascript">
        /**********判断是否加载jquey***************/
        window.jQuery || document.write('<script src="../../Script/jquery/jquery-1.4.1-vsdoc.js" type="text/javascript"><\/script>');
    </script>

    <script src="../../Script/ymPrompt/ymPrompt.js" type="text/javascript"></script>

    <link href="../../Script/ymPrompt/skin/bluebar/ymPrompt.css" rel="stylesheet" type="text/css" />

    <script type="text/javascript">
        jQuery(function() {
            //获取浏览器的高度和宽度
            var mainHeight = document.documentElement.clientHeight;
            var mainWidth = document.documentElement.clientWidth;
            //设置常用属性
            tableId = "tblStudentList";
            title = "客户详细列表";
            pageSize = 10;
            //width = mainWidth;
            //height = mainHeight;
            sortorder = "asc";
            width = "auto";
            height = mainHeight - 110;
            ajaxUrl = "../../HttpHandler/Order/Golf_OrderList.ashx";
            //设置列名(注意：主键列不用写)
            cells = new Array(
           new cell("订单号", "OrderNumber", 100, true, "left", null),
           new cell("订单金额", "OrderSumPrice", 100, true, "left", null),
           new cell("会员ID", "UserId", 100, true, "left", null),
           new cell("姓", "FristName", 100, true, "left", null),
           new cell("名", "LastName", 100, true, "left", null),
           new cell("产品总价", "ProductSumPrice", 100, true, "left", null),
           new cell("运费", "TransportationPrice", 100, true, "left", null),
           new cell("邮寄类型ID", "MailTypeId", 100, true, "left", null),
           new cell("是否优惠券", "IsCoupon", 100, true, "left", null),
           new cell("优惠金额", "CouponPrice", 100, true, "left", null),
           new cell("是否加减金额", "IsAddPrice", 100, true, "left", null),
           new cell("加减金额说明", "AddPriceState", 100, true, "left", null),
           new cell("加减金额", "AddPrice", 100, true, "left", null),
           new cell("购买产品编号", "ProductNumberList", 100, true, "left", null),
           new cell("创建订单时间", "OrderGeneratedTime", 100, true, "left", null),
           new cell("订单确认时间", "OrderVerifyTime", 100, true, "left", null),
           new cell("确认处理人ID", "VerifyNameId", 100, true, "left", null),
           new cell("收获地址ID", "AddressId", 100, true, "left", null),
           new cell("会员留言", "UserMessage", 100, true, "left", null),
           new cell("会员IP", "UserIp", 100, true, "left", null),
           new cell("是否付款", "IsPayment", 100, true, "left", null),
           new cell("付款类型ID", "PaymentTypeId", 100, true, "left", null),
           new cell("付款银行ID", "PaymentBankId", 100, true, "left", null),
           new cell("付款金额", "PaymentPrice", 100, true, "left", null),
           new cell("付款时间", "PaymentTime", 100, true, "left", null),
           new cell("付款第三方订单号", "PaymentOrderNumber", 100, true, "left", null),
           new cell("退款记录表", "RefundTypeId", 100, true, "left", null),
           new cell("物流状态ID", "LogisticsStateId", 100, true, "left", null),
           new cell("物流订单号", "Logisticsnumber", 100, true, "left", null),
           new cell("物流公司名称", "PenskeLogistics", 100, true, "left", null),
           new cell("物流备注说明", "LogisticsRemarks", 100, true, "left", null),
           new cell("订单状态ID", "OrderStateCodeId", 100, true, "left", null),
           new cell("订单总件数", "ProductOrderNumber", 100, true, "left", null),
           new cell("是否发货", "IsDeliver", 100, true, "left", null),
           new cell("发货时间", "DeliverTime", 100, true, "left", null),
           new cell("发货处理人ID", "DeliverUnitId", 100, true, "left", null),
           new cell("是否打印发货单", "IsPrintDeliver", 100, true, "left", null),
           new cell("配货处理人ID", "AllocateUnitId", 100, true, "left", null),
           new cell("配货时间", "AllocateTime", 100, true, "left", null),
           new cell("后台处理人留言ID", "AdminMessageId", 100, true, "left", null),
           new cell("是否显示", "IsShow", 100, true, "left", null),
           new cell("产品属性", "Pro_AttrList", 100, true, "left", null)
 );

            //设置菜单按钮
            buttons = new Array(
           new button("Add", "添加", "Add"),
           new button("Delete", "删除", "Delete"),
           new button("show", "详细信息", "ShowMenu"),
           new button("Update","修改","Update"),
           new button("Refresh", "刷新", "Refresh")
            );
            button_click = function(cmd, grid) {
                if (cmd == "Add") {
                    ymPrompt.win({ message: 'OrderAdd.aspx', width: 600, height: 500, title: '添加', maxBtn: true, minBtn: true, iframe: true });
                }
                //修改
                //等于修改
                if (cmd == "Update") {
                    if (confirm("你确定要修改吗？")) {
                        var chk = $("#tblStudentList input:checked");
                        var strIds = "";
                        if (chk.length == 0) {
                            alert("你需要选中后才可以删除");
                        }
                        else if (chk.length == 1) {
                            chk.each(function () {
                                strIds += chk.val();
                            });
                            //根据 条件传递Id
                            ymPrompt.win({ message: 'OrderModify.aspx?id=' + strIds, width: 600, height: 500, title: '添加', maxBtn: true, minBtn: true, iframe: true });
                        }
                    }
                }
                //删除
                if (cmd == "Delete") {
                    if (confirm("你确定要删除吗？")) {
                        var chk = $("#tblStudentList input:checked");
                        var strIds = "";
                        if (chk.length == 0) {
                            alert("你需要选中后才可以删除");
                        }
                        else if (chk.length == 1) {
                            chk.each(function () {
                                strIds += chk.val();
                            });
                            alert(strIds);
                            $.ajax({
                                type: "POST",
                                contentType: "application/x-www-form-urlencoded",
                                url: "OrderDelete.aspx?" + Math.random(),
                                data: {
                                    "action": "CommentDele",
                                    "id": escape(strIds)
                                },
                                success: function (msg) {
                                    if (msg == '0') {
                                        alert("删除成功！");
                                        //刷新框架
                                        window.parent.frames.main.location.reload();
                                    }
                                    if (msg == '1') {
                                        ymPrompt.alert("删除失败！");
                                    }
                                },
                                error: function (xhr) {
                                    alert(xhr.responseText);
                                }
                            });
                        }
                    }

                    if (cmd == "show") {
                        var chk = $("#tblStudentList input:checked");
                        var strIds = "";
                        if (chk.length == 0) {
                            ymPrompt.alert("请选择一项");
                        }
                        if (chk.length == 1) {
                            strIds = chk.val();

                        }
                        if (chk.length > 1) {
                            ymPrompt.alert("只能选择一项");
                        }
                    }
                }
            }
            //加载FlexiGrid的方法加载数据
            flexiGridLoad();

        });
    </script>

</head>
<body>
    <form id="form1" runat="server">
    <div>
        <cc1:FlexiGrid ID="FlexiGrid1" runat="server" />
        <div id="divStudentData">
            <div id="divStudentList">
                <table id="tblStudentList">
                </table>
            </div>
        </div>
    </div>
    </form>
</body>
</html>
